<?php echo $this->Form->create('Emprestimo');?>
<?php echo $this->Form->input('id');?>
<div class="modal-header">
    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
    <h4>Confirmar Devolução</h4>
</div>
 <div class="modal-body">
	<fieldset>
		<div class="row-fluid">
		<div class="span5">
			<div class="control-group">
				<?php echo $this->Form->Label('Aluno.nome', 'Aluno', array('class' => 'control-label'));	?>
				<div class="controls">
					<?php echo $this->Form->input('Aluno.nome', array('label' => false, 'div' => false, 'disabled', 'class' => 'span12'));	?>
				</div>
			</div>
		</div>
		<div class="span5">
			<div class="control-group">
				<?php echo $this->Form->Label('Projeto.nome', 'Projeto', array('class' => 'control-label'));	?>
				<div class="controls">
					<?php echo $this->Form->input('Projeto.nome', array('label' => false, 'div' => false, 'disabled', 'class' => 'span12'));	?>
				</div>
			</div>
		</div>
		</div>
		<div class="row-fluid">
		<div class="span10">
			<div class="control-group">
				<?php echo $this->Form->Label('Autorizador.nome', 'Professor que autorizou', array('class' => 'control-label'));	?>
				<div class="controls">
					<?php echo $this->Form->input('Autorizador.nome', array('label' => false, 'div' => false, 'disabled', 'class' => 'span12'));	?>
				</div>
			</div>
		</div>
		</div>
		<div class="row-fluid">
			<div class="control-group span5">
				<?php echo $this->Form->Label('data_inicio', 'Data de início', array('class' => 'control-label'));	?>
				<div class="controls">
					<div class="input-append span11">
						<?php $this->request->data['Emprestimo']['data_inicio'] = (!empty($this->request->data['Emprestimo']['data_inicio'])) ? date('d/m/Y', strtotime($this->request->data['Emprestimo']['data_inicio'])) : ''; ?>
						<?php echo $this->Form->input('data_inicio', array('type' => 'text', 'label' => false, 'div' => false, 'class' => 'span11', 'required' => false, 'error' => false, 'disabled')); ?>
						<span class="add-on"><i class="icon-calendar"></i></span>
					</div>
				</div>
			</div>
			<div class="control-group span5">
				<?php echo $this->Form->Label('data_entrega', 'Data de entrega', array('class' => 'control-label'));	?>
				<div class="controls">
					<div class="input-append span11">
						<?php $this->request->data['Emprestimo']['data_entrega'] = (!empty($this->request->data['Emprestimo']['data_entrega'])) ? date('d/m/Y', strtotime($this->request->data['Emprestimo']['data_entrega'])) : ''; ?>	
						<?php echo $this->Form->input('data_entrega', array('type' => 'text', 'label' => false, 'div' => false, 'class' => 'span11', 'required' => false, 'error' => false, 'disabled')); ?>
						<span class="add-on"><i class="icon-calendar"></i></span>
					</div>
				</div>
			</div>
		</div>
	</fieldset>
		
		<?php if (!empty($this->data['Itensemprestimo'])) { ?>
			<table class="table table-bordered table-striped">
			<thead>
			<tr>
				<th>Código</th>
				<th>Equipamento</th>
				<th>Quantidade</th>
			</tr>
			</thead>
			<tbody>
		<?php
			foreach ($this->data['Itensemprestimo'] as $item): ?>
			<tr>
				<td><?php echo h($item['Equipamento']['id']); ?>&nbsp;</td>
				<td><?php echo h($item['Equipamento']['descricao']); ?>&nbsp;</td>
				<td><?php echo h($item['quantidade']); ?>&nbsp;</td>
			</tr>
		<?php endforeach; ?>
			</tbody>
			</table>
		<?php } ?>
		<?php echo $this->Form->input('Emprestimo.observacao', array(
				'label' => 'Observação',
				'rows' => 2,
				'type' => 'textarea', 
				'class' => 'span12')); ?>		
	</div>
  	<div class="modal-footer">
   	<?php echo $this->Js->submit('Confirmar', array(
		'url' => array('controller' => 'emprestimos', 'action' => 'devolucao'),
		'update' => '#window-modal',
    	'class' => "btn btn-primary",
   	    'before' => $this->Js->get('#ajax-indicator')->effect('fadeIn', array('buffer' => false)),
	    'complete' => $this->Js->get('#ajax-indicator')->effect('fadeOut', array('buffer' => false)),
		'buffer' => false,
		'div' => false
	));?>
	<a href="#" class="btn" data-dismiss="modal" >Cancelar</a>    
 </div>
<?php echo $this->Form->end();?>